/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ftpcombiner.gui.applicationframe.framesplitter.filetable;

import ftpcombiner.gui.GUIResources;
import ftpcombiner.server.virtualfiles.VirtualFile;
import ftpcombiner.server.virtualfiles.VirtualFolder;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author Ben
 */
public class FileTableRenderer extends DefaultTableCellRenderer {


    public FileTableRenderer() {
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        setText(value.toString());
        if (value instanceof VirtualFolder) {
            setIcon(GUIResources.getInstance().getFolderIcon());
        } else if (value instanceof VirtualFile) {
            setIcon(GUIResources.getInstance().getFileIcon());
        } else if (value.equals("Up...")) {
            setIcon(GUIResources.getInstance().getUpIcon());
        }
        if (isSelected) {
            setBackground(new Color(153, 238, 204));
        } else {
            setBackground(Color.WHITE);
        }
        return this;
    }
}
